package cn.zhz.office.convert.pdf.controller;

import cn.zhz.office.convert.pdf.util.PdfConvertUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ZHZ
 * @since 2023-01-30
 */
@RestController
@RequestMapping("/pdf")
public class PdfController {


    @PostMapping("/toImage")
    public void toImage(@RequestParam MultipartFile file, HttpServletResponse response) throws IOException {
        PdfConvertUtil.toImage(file.getInputStream(), response.getOutputStream());
    }


}
